package vo
{
	import mx.messaging.ChannelSet;
	import mx.messaging.channels.AMFChannel;
	import mx.rpc.remoting.RemoteObject;
	
	[Bindable]
	public class ROFactory
	{
		public function ROFactory()
		{
		}

		//private static var instance:ROFactory;
		private var cset:ChannelSet;
		private var orderRemoteObject:RemoteObject;
		private var userRemoteObject:RemoteObject;
		private var newsRemoteObject:RemoteObject;
		private var memberLeverRemoteObject:RemoteObject;
		private var gameRemoteObject:RemoteObject;
		private var accessRemoteObject:RemoteObject;
		private var cserverRemoteObject:RemoteObject;
		private var gameStoreRemoteObject:RemoteObject;
		private var moneyRecordRemoteObject:RemoteObject;
		private var managerLogRemoteObject:RemoteObject;
		private var managerRemoteObject:RemoteObject;
		private var cpRemoteObject:RemoteObject;
		private var complainRemoteObject:RemoteObject;
		private var businessRemoteObject:RemoteObject;
		private var contactRemoteObject:RemoteObject;
		private var exchangeRemoteObject:RemoteObject;
		private var configRemoteObject:RemoteObject;
		
		public static function getInstance():ROFactory {
//			if(instance == null)
//	             instance = new  ROFactory();
	        return new ROFactory();	 
		}
		
		public function  getChannelSet():ChannelSet{
			if(cset == null){
				cset=new ChannelSet();
				var amfc:AMFChannel=new AMFChannel();
				amfc.url=ModelLocator.getInstance().serverUrl+"/messagebroker/amf";			
				cset.addChannel(amfc);
			}
			return cset;	 
		}
		public function  getConfigRemoteObject():RemoteObject{
			if(configRemoteObject==null){
				configRemoteObject=new RemoteObject();	
				configRemoteObject.channelSet=getChannelSet();
				configRemoteObject.destination="configService";
			}
			return configRemoteObject;
		}
		public function  getCpRemoteObject():RemoteObject{
			if(cpRemoteObject==null){
				cpRemoteObject=new RemoteObject();	
				cpRemoteObject.channelSet=getChannelSet();
				cpRemoteObject.destination="cpService";
			}
			return cpRemoteObject;
		}
		public function  getComplainRemoteObject():RemoteObject{
			if(complainRemoteObject==null){
				complainRemoteObject=new RemoteObject();	
				complainRemoteObject.channelSet=getChannelSet();
				complainRemoteObject.destination="complainService";
			}
			return complainRemoteObject;
		}
		
		public function  getOrderRemoteObject():RemoteObject{
			if(orderRemoteObject==null){
				orderRemoteObject=new RemoteObject();	
				orderRemoteObject.channelSet=getChannelSet();
				orderRemoteObject.destination="orderService";
			}
			return orderRemoteObject;
		}
		
		public function  getUserRemoteObject():RemoteObject{
			if(userRemoteObject==null){
				userRemoteObject=new RemoteObject();	
				userRemoteObject.channelSet=getChannelSet();
				userRemoteObject.destination="userService";
			}
			return userRemoteObject;
		}
		public function  getNewsRemoteObject():RemoteObject{
			if(newsRemoteObject==null){
				newsRemoteObject=new RemoteObject();	
				newsRemoteObject.channelSet=getChannelSet();
				newsRemoteObject.destination="newsService";
			}
			return newsRemoteObject;
		}
		public function  getMemberLeverRemoteObject():RemoteObject{
			if(memberLeverRemoteObject==null){
				memberLeverRemoteObject=new RemoteObject();	
				memberLeverRemoteObject.channelSet=getChannelSet();
				memberLeverRemoteObject.destination="memberlevelService";
			}
			return memberLeverRemoteObject;
		}
		public function  getGameRemoteObject():RemoteObject{
			if(gameRemoteObject==null){
				gameRemoteObject=new RemoteObject();	
				gameRemoteObject.channelSet=getChannelSet();
				gameRemoteObject.destination="gameService";
			}
			return gameRemoteObject;
		}
		public function  getAccessRemoteObject():RemoteObject{
			if(accessRemoteObject==null){
				accessRemoteObject=new RemoteObject();	
				accessRemoteObject.channelSet=getChannelSet();
				accessRemoteObject.destination="accessService";
			}
			return accessRemoteObject;
		}
		public function  getCserverRemoteObject():RemoteObject{
			if(cserverRemoteObject==null){
				cserverRemoteObject=new RemoteObject();	
				cserverRemoteObject.channelSet=getChannelSet();
				cserverRemoteObject.destination="cserverService";
			}
			return cserverRemoteObject;
		}
		public function  getGameStoreRemoteObject():RemoteObject{
			if(gameStoreRemoteObject==null){
				gameStoreRemoteObject=new RemoteObject();	
				gameStoreRemoteObject.channelSet=getChannelSet();
				gameStoreRemoteObject.destination="gameStoreService";
			}
			return gameStoreRemoteObject;
		}
		public function  getMoneyRecordRemoteObject():RemoteObject{
			if(moneyRecordRemoteObject==null){
				moneyRecordRemoteObject=new RemoteObject();	
				moneyRecordRemoteObject.channelSet=getChannelSet();
				moneyRecordRemoteObject.destination="moneyRecordService";
			}
			return moneyRecordRemoteObject;
		}
		public function  getManagerLogRemoteObject():RemoteObject{
			if(managerLogRemoteObject==null){
				managerLogRemoteObject=new RemoteObject();	
				managerLogRemoteObject.channelSet=getChannelSet();
				managerLogRemoteObject.destination="managerLogService";
			}
			return managerLogRemoteObject;
		}
		public function  getManagerRemoteObject():RemoteObject{
			if(managerRemoteObject==null){
				managerRemoteObject=new RemoteObject();	
				managerRemoteObject.channelSet=getChannelSet();
				managerRemoteObject.destination="managerService";
			}
			return managerRemoteObject;
		}
		public function  getBusinessRemoteObject():RemoteObject{
			if(businessRemoteObject==null){
				businessRemoteObject=new RemoteObject();	
				businessRemoteObject.channelSet=getChannelSet();
				businessRemoteObject.destination="businessService";
			}
			return businessRemoteObject;
		}
		public function  getContactRemoteObject():RemoteObject{
			if(contactRemoteObject==null){
				contactRemoteObject=new RemoteObject();	
				contactRemoteObject.channelSet=getChannelSet();
				contactRemoteObject.destination="contactService";
			}
			return contactRemoteObject;
		}
		public function  getExchangeRemoteObject():RemoteObject{
			if(exchangeRemoteObject==null){
				exchangeRemoteObject=new RemoteObject();	
				exchangeRemoteObject.channelSet=getChannelSet();
				exchangeRemoteObject.destination="exchangeService";
			}
			return exchangeRemoteObject;
		}
	}
}